<template>
	<view class="container">
		
		<view class="reportView">
			<uni-row class="uni-row">
				<uni-col>
					<text class="title">院系名称：</text>
					<view class="input-item flex align-center">
					  <input  placeholder="请输入院系名称" placeholder-class="place" v-model="FormData.facultyName" class="input" type="text"  maxlength="30" />
					</view>
				</uni-col>
			</uni-row>

			<uni-row class="uni-row">
				<uni-col :span="12">
					<text class="title">负责人:</text>
					<view class="input-item flex align-center">
					  <uni-data-picker placeholder="请选择负责人" placeholder-class="place" class="picker"
					    v-model="FormData.principal"
					    :localdata="range"
							:map="map"
					  ></uni-data-picker >
					</view>
				</uni-col>
			</uni-row>
			<uni-row class="uni-row">
				<uni-col>
					<text class="title">联系方式：</text>
					<view class="input-item flex align-center">
					  <input  placeholder="请输入联系方式" placeholder-class="place"  v-model="FormData.principalPhone" class="input" type="text"  maxlength="30" />
					</view>
				</uni-col>
			</uni-row>
		</view>
		<view class="submit-view">
			<button class='submit'  @tap="clickBtn">完成</button>
		</view>
	</view>
</template>
<script>
	import { getFacultyById } from '@/api/school/school.js'
	import {getUserList} from '@/api/system/user.js'
	export default{
		data(){
			return{
				id:null,
				range:[],
				map:{
					text:'nickname',
					value:'nickname'
				},
				FormData:{
					parentId:1,
					categoryName:null,
					categoryDesc:null,
					sort:1,
					status:null,
					type:null,
					photoUrl:null
				}
				
			}
		},
		onLoad(e) {
			if(e.id != null && e.id != ''){
				this.id = e.id
				this.getData();
			}
			this.getUser()
		},
		created() {
			
		},
		methods:{
			clickToBank(){
				this.$tab.navigateTo(`/pages/work/exam/questionBank`)
			},
			getData(){
				let data={
					id:this.id
				}
				getFacultyById(data).then(res=>{
					this.FormData = res.data
				})
			},
			getUser(){
				getUserList().then(res=>{
					this.range=res.data.list
				})
			},
			clickBtn(){
				updateCate(this.FormData).then(res=>{
					if(res.data === true){
						uni.navigateBack({
							delta:1
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.container{
		background-color: #fff;
		height: 100vh;
		.reportView{
			width: calc(100% - 80rpx);
			margin: 0 auto;
			.title{
				font-size: 14px;
				font-family: Inter-Bold, Inter;
				font-weight: bold;
				color: #000000;
				line-height: 40px;
				padding-left: 10px;
			}
			.textarea{
				
			}
			
			.input-item{
				background-color: #ffffff;
				height: 47px;
				border-radius: 10px;
				opacity: 1;
				border: 1px solid #508CFF;
				padding: 20px;
				.place{
					font-size: 12px;
				}
				/deep/ .uni-select{
					border: none;
					border-bottom: none;
					padding-left: 0;
				}
			}
			.uni-row{
				margin-bottom: 10px;
			}
			.picker{
				/deep/ .input-value-border{
					border: none;
					box-shadow: none;
				}
			}
			
		}
		.submit{
			color: #fff;
			width: 100px;
			height: 40px;
			font-size: 14px;
			line-height: 40px;
			background: #508CFF;
			border-radius: 5px 5px 5px 5px;
			position: absolute;
			bottom: 50px;
			left: 36%;
		}
	}
</style>